-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Core: Add gpu rendering support #185
base: main
Are you sure you want to change the base?
Conversation
@fufexan nix fix plx |
@gulafaran you did some memory leak analysis, I can't get valgrind or lsan to run on this, any ideas to track down the leak? |
il poke around tomorrow and see if i can get it to find something useful |
thanks bae |
here is the temp changes i make to get asan to produce something.
this PR has a new issue on destruction
im gonna have to hunt down a recent mesa shader cache fd leak before i dig any deeper but feel free to asan it you too :) |
there is also hyprpaper/src/render/LayerSurface.cpp Line 38 in d82aec0
|
enum casting out of range is a classic in wayland I don't think we gon' escape that one. Is it still UB even though we define it as |
well |
for example in wlroots,
it seems to be dealing with uint32_t all over and just using the enum values for references to what is what. it never casts it out of range that is |
in short, im not fully read up how things are built up to a working source but i suspect hyprwayland-scanner builds the protocol things from the .xml files. perhaps it should just use the datatype of the protocol as parameters to the functions.
and on the sending and recieving side you still use uint32_t and just check its values if they are within range of the enum or exact values of the enum. and the enum decides what values does what or not. instead of trying to cast the enum to a value and send that as a parameter and as a consequence UB and out of range casting when all it does is technically send uint32_t. just an idea from a random newb. :D , god i suck at trying to explain what im thinking too. |
hw-s puts the enums there so that you know what it is. In actuality, it's just used as an uint32_t. |
but what is creating sendSetAnchor and its parameters? |
because thats what we should be changing to uint32_t instead. like wlr-layer-shell-unstable.hpp
wlr-layer-shell-unstable.cpp
wl_proxy_marshal_flags already takes an uint32_t as its flags. meaning in layersurface.cpp it can use
and then there is no casting out of range. same deal with all the out of casting enums in hyprland and the other tools. |
but then you could mistakenly take the wrong enum |
well imo rather that then UB, one of the key issues with UB is it can show itself just as in recent conversations in hyprwm/Hyprland#6608 "working" in debug builds but as fast as higher optimisation levels are applied the compiler just strips out things that should be there. and crashes on release builds. or even cause really wonky memory issues. unless you got any other ideas i would go with the route of maybe wrong values instead of relying on chance the compiler gets it somewhat right ("it usually doesnt") , in this case who knows what it does its undefined after all but what if its doing anything like this famous horror example https://godbolt.org/z/3Pqojanqo eraseall is never called and yet it is. implentation bugs versus language/compiler bugs sort of. one is solveable one isnt |
lmao the linked one is indeed a disaster I don't think the compiler is allowed to optimize here as we added |
pushed to hw-s |
cool :) now just a few minor changes in the hyprwm land then. heres hyperpaper., il see if i got the time to dig around the other tools tomorrow for out of range casts. trying to repaint the house and they are showing good weather tomorrow so a bit busy with that too heh
|
no hurries, everything should still compile. If you could just make MRs whenever you have a moment |
I've dropped the commit as its a breaking change... we gotta figure out a different way. One thing of note: doesn't wayland itself do this all the time? |
hm, no, it uses uint32_t... I don't know how to make this non-breaking, though. Any ideas? |
Had to bring out the big ctrl + f in the c++ std (...) If the enumeration type has a fixed underlying type, the value is first converted to that type by integral conversion, if necessary, and then to the enumeration type. If the enumeration type does not have a fixed underlying type, the value is unchanged if the original value is within the range of the enumeration values (9.7.1), and otherwise, the behavior is undefined. Indeed seems c++ allow this as long as the type is fixed |
:D yours truly |
I've verified the leak is not there on main also @gulafaran do you have an idea why gbm_device_create ups the VmRSS like 120MB??? |
tried fiddling with asan/valgrind im not sure why something sneaky is going on asan runs it but valgrind segfaults
either im doing something wrong or something very wonky is going on heh |
thats not my code :) |
yeah i might be hitting some mesa-git funzies but asan doesnt report anything nasty and the gl/shader code is beyond my knowledge are they somehow doing something? like missing glDeleteProgram or glDetachShader |
would be odd cuz we leaking ram not vram |
Adds support (enabled by default) for gpu rendering
Bugs: